using System;
using System.Collections;

namespace Tp.Interfaces
{
	public interface IUnityServiceLocator
	{
		/// <summary>
		/// Gets this instance.
		/// </summary>
		/// <typeparam name="T"><see cref="Type"/> of object to get from the container.</typeparam>
		/// <returns>The retrieved object.</returns>
		T Get<T>();

		/// <summary>
		/// Gets the specified type.
		/// </summary>
		/// <param name="type">The requested type.</param>
		/// <returns>The retrieved object.</returns>
		Type Get(Type type);

		/// <summary>
		/// Get's all.
		/// </summary>
		/// <typeparam name="T"><see cref="Type"/> of object to get from the container.</typeparam>
		/// <returns>The retrieved object.</returns>
		IEnumerable GetAll<T>();

		/// <summary>
		/// Gets the specified key.
		/// </summary>
		/// <typeparam name="T"><see cref="Type"/> of object to get from the container.</typeparam>
		/// <param name="key">The requested key.</param>
		/// <returns>The retrieved object.</returns>
		T Get<T>(string key);

		/// <summary>
		/// Injects the specified instance.
		/// </summary>
		/// <typeparam name="T"><see cref="Type"/> of object to get from the container.</typeparam>
		/// <param name="instance">The requested instance.</param>
		void Inject<T>(T instance);

		/// <summary>
		/// Injects as singleton.
		/// </summary>
		/// <typeparam name="T"><see cref="Type"/> of object to get from the container.</typeparam>
		/// <param name="instance">The requested instance.</param>
		void InjectAsSingleton<T>(T instance);

		/// <summary>
		/// Registers this instance.
		/// </summary>
		/// <typeparam name="TInterface">The type of the interface.</typeparam>
		/// <typeparam name="TImplementor">The type of the implementor.</typeparam>
		void Register<TInterface, TImplementor>() where TImplementor : TInterface;

		/// <summary>
		/// Registers the specified key.
		/// </summary>
		/// <typeparam name="TInterface">The type of the interface.</typeparam>
		/// <typeparam name="TImplementor">The type of the implementor.</typeparam>
		/// <param name="key">The requested key.</param>
		void Register<TInterface, TImplementor>(string key) where TImplementor : TInterface;

		/// <summary>
		/// Registers as singleton.
		/// </summary>
		/// <typeparam name="TInterface">The type of the interface.</typeparam>
		/// <typeparam name="TImplementor">The type of the implementor.</typeparam>
		void RegisterAsSingleton<TInterface, TImplementor>() where TImplementor : TInterface;
	}
}